package org.jeemp.config;

import com.nepxion.banner.BannerConstant;
import com.nepxion.banner.Description;
import com.nepxion.banner.LogoBanner;
import com.taobao.text.Color;
import org.jeemp.constant.CommonConstant;
import org.jeemp.utils.CustomBanner;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author JackRen
 * @date 2021-03-22 16:32
 * @description:
 */
public class BannerInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
    @Override
    public void initialize(ConfigurableApplicationContext applicationContext) {

        if (!(applicationContext instanceof AnnotationConfigApplicationContext)) {
            LogoBanner banner = new LogoBanner(BannerInitializer.class,"/jeemp/logo.txt",
                    "Welcome to Jeemp-boot",5, 6, new Color[5], true);
            CustomBanner.show(banner,new Description(BannerConstant.VERSION + ":", CommonConstant.PROJECT_VERSION, 0, 1)
                    , new Description("Blog:", "https://blog.csdn.net/JackRen_Developer", 0, 1)
            );
        }

    }
}
